package com.jadows.tdog.util;


import com.jadows.tdog.dto.UserInfo;

/**
 * @author taojiacheng
 */
public class SecurityUtil {

    private static final ThreadLocal<UserInfo> USER_DTO_THREAD_LOCAL = new ThreadLocal<>();

    public static UserInfo getCurrentUser() {
        return USER_DTO_THREAD_LOCAL.get();
    }

    public static void setCurrentUser(UserInfo userInfo) {
        USER_DTO_THREAD_LOCAL.set(userInfo);
    }

    public static void removeCurrentUser() {
        USER_DTO_THREAD_LOCAL.remove();
    }
}
